<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>单表管理</title>
    <meta name="decorator" content="default"/>
    <%@include file="/WEB-INF/views/include/adminlte.jsp" %>
    <script type="text/javascript">
        $(document).ready(function () {

        });
        function page(n, s) {
            $("#pageNo").val(n);
            $("#pageSize").val(s);
            $("#searchForm").submit();
            return false;
        }
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li class="active"><a href="${ctx}/test/testData/">单表列表</a></li>
    <shiro:hasPermission name="test:testData:edit">
        <li><a href="${ctx}/test/testData/form">单表添加</a></li>
    </shiro:hasPermission>
</ul>
<form:form id="searchForm" modelAttribute="testData" action="${ctx}/test/testData/" method="post"
           class="row form-horizontal well" role="form">
    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
    <div class="row">
        <div class="form-group col-sm-4">
            <label class="col-sm-4 control-label">归属用户：</label>
            <div class="col-sm-8">
                <sys:treeselect id="user" name="user.id" value="${testData.user.id}" labelName="user.name"
                                labelValue="${testData.user.name}"
                                title="用户" url="/sys/office/treeData?type=3" cssClass="form-control" allowClear="true"
                                notAllowSelectParent="true"/>
            </div>
        </div>
        <div class="form-group col-sm-4">
            <label class="col-sm-4 control-label">归属部门：</label>
            <div class="col-sm-8">
                <sys:treeselect id="office" name="office.id" value="${testData.office.id}" labelName="office.name"
                                labelValue="${testData.office.name}"
                                title="部门" url="/sys/office/treeData?type=2" cssClass="form-control" allowClear="true"
                                notAllowSelectParent="true"/>
            </div>
        </div>
        <div class="form-group col-sm-4">
            <label class="col-sm-4 control-label">归属区域：</label>
            <div class="col-sm-8">
                <sys:treeselect id="area" name="area.id" value="${testData.area.id}" labelName="area.name"
                                labelValue="${testData.area.name}"
                                title="区域" url="/sys/area/treeData" cssClass="form-control" allowClear="true"
                                notAllowSelectParent="true"/>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="form-group col-sm-4">
            <label class="col-sm-4 control-label">名称：</label>
            <div class="col-sm-8">
                <form:input path="name" htmlEscape="false" maxlength="100" class="form-control"/>
            </div>
        </div>
        <div class="form-group col-sm-4">
            <label class="col-sm-4 control-label">性别：</label>
            <div class="col-sm-8">
                <form:radiobuttons path="sex" items="${fns:getDictList('sex')}" itemLabel="label" itemValue="value"
                                   htmlEscape="false"/>
            </div>
        </div>
        <div class="form-group col-sm-4">
            <label class="col-sm-4 control-label">加入日期：</label>
            <div class="col-sm-9 row">
                <div class="col-sm-5">
                    <input name="beginInDate" type="text" readonly="readonly" maxlength="20"
                           class="form-control  Wdate"
                           value="<fmt:formatDate value="${testData.beginInDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
                           onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
                </div>
                <div class="col-sm-1">
                    <span>-</span>
                </div>
                <div class="col-sm-5">
                    <input name="endInDate" type="text" readonly="readonly" maxlength="20"
                           class="form-control col-sm-6 Wdate"
                           value="<fmt:formatDate value="${testData.endInDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
                           onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
                </div>
            </div>
        </div>
    </div>
    <input id="btnSubmit" class="btn btn-primary pull-right" type="submit" value="查询"/>

</form:form>
<sys:message content="${message}"/>
<table id="contentTable" class="table table-hover">
    <thead>
    <tr>
        <td>归属用户</td>
        <td>归属部门</td>
        <td>归属区域</td>
        <td>名称</td>
        <td>性别</td>
        <td>更新时间</td>
        <td>备注信息</td>
        <shiro:hasPermission name="test:testData:edit">
            <td>操作</td>
        </shiro:hasPermission>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${page.list}" var="testData">
        <tr>
            <td><a href="${ctx}/test/testData/form?id=${testData.id}">
                    ${testData.user.name}
            </a></td>
            <td>
                    ${testData.office.name}
            </td>
            <td>
                    ${testData.area.name}
            </td>
            <td>
                    ${testData.name}
            </td>
            <td>
                    ${fns:getDictLabel(testData.sex, 'sex', '')}
            </td>
            <td>
                <fmt:formatDate value="${testData.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
            </td>
            <td>
                    ${testData.remarks}
            </td>
            <shiro:hasPermission name="test:testData:edit">
                <td>
                    <a href="${ctx}/test/testData/form?id=${testData.id}">修改</a>
                    <a href="${ctx}/test/testData/delete?id=${testData.id}"
                       onclick="return confirmx('确认要删除该单表吗？', this.href)">删除</a>
                </td>
            </shiro:hasPermission>
        </tr>
    </c:forEach>
    </tbody>
</table>
<div class="box-tools">${page}</div>
</body>
</html>